package top.eggcode.component.dingtalk;

import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

@EnableConfigurationProperties(DingTalkRobotProperties.class)
@Configuration
public class DingTalkConfig {

    @Resource
    private DingTalkRobotProperties robotProperty;

    @Bean("dingRobotClient")
    public DingRobotClient createRobotClient() {
        return new DingRobotClientImpl(robotProperty.getWebhookUrl(), robotProperty.getSecret());
    }
}
